package com.wcbtest.oshi.domain;

import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;


@ApiModel(value = "文件系统信息")
@Data
public class DiskStores implements Serializable {
    @ApiModelProperty(value = "此磁盘的统计信息的更新时间。")
    private Long timeStamp;
    @ApiModelProperty(value = "写入磁盘的字节数")
    private Long writeBytes;
    @ApiModelProperty(value = "磁盘的大小")
    private Long size;
    @ApiModelProperty(value = "读取或写入所花费的时间，以毫秒为单位。")
    private Long transferTime;
    private String transferTimeFormat;
    @ApiModelProperty(value = "磁盘序列号（如果可用）。")
    private String serial;
    @ApiModelProperty(value = "磁盘名称")
    private String name;
    @ApiModelProperty(value = "从磁盘读取的次数")
    private Long reads;
    @ApiModelProperty(value = "从磁盘读取的字节数")
    private Long readBytes;
    @ApiModelProperty(value = "磁盘模型")
    private String model;
    @ApiModelProperty(value = "磁盘写入次数")
    private Long writes;
    @ApiModelProperty(value = "队列数")
    private Long currentQueueLength;
    @ApiModelProperty(value = "此磁盘上的分区。")
    private List<PartitionDTO> partition;


    public String getTransferTimeFormat() {
        return transferTime == null ? null : DateUtil.formatBetween(transferTime);
    }

    @NoArgsConstructor
    @Data
    public static class PartitionDTO {
        @ApiModelProperty(value = "挂载分区")
        private String mountPoint;
        @ApiModelProperty(value = "分区ID")
        private String identification;
        @ApiModelProperty(value = "主要ID")
        private Integer major;
        @ApiModelProperty(value = "次要ID")
        private Integer minor;
        @ApiModelProperty(value = "大小")
        private Long size;
        @ApiModelProperty(value = "名称")
        private String name;
        @ApiModelProperty(value = "类型")
        private String type;
        @ApiModelProperty(value = "uuid")
        private String uuid;
    }
}